/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.edu.kamai.xmlparser.writing;

import com.edu.kamai.xml.beans.writing.writingAnswer;
import com.edu.kamai.xmlparser.answerGeneration;
import org.jdom.Document;
import org.jdom.Element;

/**
 *
 * @author xyzhu
 */
public class writingAnswerGeneration extends answerGeneration{
    
    public writingAnswerGeneration(writingAnswer bean){
        wa = bean;
    }
    
    public void generateXML(){
        document = new Document();
        Element root = generateHead(wa.getPaperID(), wa.getUserID());
        
        for(int i=0;i<wa.getWritingContent().size();i++){
            Element child = new Element("writingAnswer");
            child.addContent(new Element("content").setText(wa.getWritingContent().get(i)));
            root.addContent(child);
        }
        document.setContent(root);
    }
    
    private writingAnswer wa;
    
}
